#include <string>
#include <iostream>
#include<ostream>
#include "Meeting.h"
#include <math.h>
using namespace std;


	//Default Constructor
	Meeting::Meeting():subject(""){
		this->whoAmI = 2;
		this->start_t = 0;
		this->end_t = 0;
		//this->subject = ""
	}
	//Destructor
	Meeting::~Meeting(){
	}

	//Copy Constructor
	Meeting::Meeting(const Meeting& m){
		this->start_t = m.start_t;
		this->whoAmI =BASE;
		this->end_t = m.end_t;
		this->subject = m.subject;
	}

	//Constructor for regular meetings
	Meeting::Meeting(float start_t,float end_t, string& subj){
		this->start_t = start_t;
		this->end_t = end_t;
		this->subject = subj;
		this->whoAmI =BASE;
	}

	//This is a virtual function. In this function we determine an overlap only by hours.
	 const bool Meeting::overlapWith(const Meeting& m) const {
		 return (this->end_t<=m.end_t&&this->end_t>m.start_t)
			 || (this->start_t<m.end_t&&this->start_t>=m.start_t);
	 }


	const float Meeting::getStartHour() const{
		return this->start_t;
	}

	void Meeting::setStartHour(float t){
		this->start_t = t;
	}

	const float Meeting::getEndHour() const{
		return this->end_t;
	}

	void Meeting::setEndHour(float t){
		this->end_t = t;
	}

	const string& Meeting::getSubject() const{
		return this->subject;
	}

	void Meeting::setSubject(const string& subj){
		this->subject = subj;
	}


	void Meeting::printMeeting() const {
		cout<<"Meeting subject: "<<this->subject<<endl;
		int st_minutes = (start_t-floor(start_t))*60;
		int end_minutes = (end_t-floor(end_t))*60;



		if (st_minutes == 0) {
			cout<<"Meeting start time: "<< floor(start_t)<<":"<<"00"<<endl;
		}
		else
			cout<<"Meeting start time: "<< floor(start_t)<<":"<<st_minutes<<endl;
		if (end_minutes == 0)
			cout<<"Meeting end time: "<< floor(end_t)<<":"<<"00"<<endl;
		else
			cout<<"Meeting end time: "<< floor(end_t)<<":"<<end_minutes<<endl;

	}


const int Meeting::getWhoAmI() const{
	return whoAmI;
}
